Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

csireverseproxy - improve UT coverage #451

Conversation

bharathsreekanth
Copy link
Contributor

@bharathsreekanth bharathsreekanth commented Feb 10, 2025

Description

Increase UT coverage for main and pkg/config in csireverseproxy. Note: This is not merge to MAIN but to usr/spark/unit-test-improvements branch.

Note:

  1. unused functions ( a couple of DeepCopy) were removed.
  2. StartInformer signature modified, was not returning anything but nil
  3. Some structs were moved to the top of file for better readability.
  4. Methods in main.go main() and run() are now dependency injected to improve testability.

GitHub Issues

List the GitHub issues impacted by this PR:

GitHub Issue #

Checklist:

  • Have you run format,vet & lint checks against your submission?
  • Have you made sure that the code compiles?
  • Did you run the unit & integration tests successfully?
  • Have you maintained at least 90% code coverage?
  • Have you commented your code, particularly in hard-to-understand areas
  • Have you done corresponding changes to the documentation
  • Did you run tests in a real Kubernetes cluster?
  • Backward compatibility is not broken

How Has This Been Tested?

Unit test run:
ok revproxy/v2/pkg/config 0.995s coverage: 90.9% of statements
ok revproxy/v2 3.616s coverage: 90.3% of statements

cert-csi run with image built from this branch:

Tests:

  1. TestCase: VolumeIoSuite
    Started: 2025-02-10 15:56:02.84276917 +0000 UTC
    Ended: 2025-02-10 16:05:33.366058413 +0000 UTC
    Result: SUCCESS

         Stage metrics:
                 PVCAttachment:
                     Avg: 9.150266055s
                     Min: 6.068738574s
                     Max: 10.400494338s
                     Histogram:
     /root/.cert-csi/reports/test-run-a888432c/VolumeIoSuite7/PVCAttachment.png
                     BoxPlot:
     /root/.cert-csi/reports/test-run-a888432c/VolumeIoSuite7/PVCAttachment_boxplot.png
                 PVCBind:
                     Avg: 5.212699664s
                     Min: 4.432488s
                     Max: 6.871985705s
                     Histogram:
     /root/.cert-csi/reports/test-run-a888432c/VolumeIoSuite7/PVCBind.png
                     BoxPlot:
     /root/.cert-csi/reports/test-run-a888432c/VolumeIoSuite7/PVCBind_boxplot.png
                 PVCCreation:
                     Avg: 14.982617498s
                     Min: 13.90772687s
                     Max: 15.439022831s
                     Histogram:
     /root/.cert-csi/reports/test-run-a888432c/VolumeIoSuite7/PVCCreation.png
                     BoxPlot:
     /root/.cert-csi/reports/test-run-a888432c/VolumeIoSuite7/PVCCreation_boxplot.png
                 PVCDeletion:
                     Avg: 38.87106ms
                     Min: 21.435327ms
                     Max: 53.284679ms
                     Histogram:
     /root/.cert-csi/reports/test-run-a888432c/VolumeIoSuite7/PVCDeletion.png
                     BoxPlot:
     /root/.cert-csi/reports/test-run-a888432c/VolumeIoSuite7/PVCDeletion_boxplot.png
                 PVCUnattachment:
                     Avg: 1.986117825s
                     Min: 1.854954413s
                     Max: 2.392359051s
                     Histogram:
     /root/.cert-csi/reports/test-run-a888432c/VolumeIoSuite7/PVCUnattachment.png
                     BoxPlot:
     /root/.cert-csi/reports/test-run-a888432c/VolumeIoSuite7/PVCUnattachment_boxplot.png
                 PodCreation:
                     Avg: 1m0.533543652s
                     Min: 29.907716147s
                     Max: 1m45.918245458s
                     Histogram:
     /root/.cert-csi/reports/test-run-a888432c/VolumeIoSuite7/PodCreation.png
                     BoxPlot:
     /root/.cert-csi/reports/test-run-a888432c/VolumeIoSuite7/PodCreation_boxplot.png
                 PodDeletion:
                     Avg: 12.855521834s
                     Min: 7.982860897s
                     Max: 21.208691894s
                     Histogram:
     /root/.cert-csi/reports/test-run-a888432c/VolumeIoSuite7/PodDeletion.png
                     BoxPlot:
     /root/.cert-csi/reports/test-run-a888432c/VolumeIoSuite7/PodDeletion_boxplot.png
                     EntityNumberOverTime:
     /root/.cert-csi/reports/test-run-a888432c/VolumeIoSuite7/EntityNumberOverTime.png
    

[2025-02-10 16:05:33] INFO Avg time of a run: 554.23s
[2025-02-10 16:05:33] INFO Avg time of a del: 12.01s
[2025-02-10 16:05:33] INFO Avg time of all: 570.52s
[2025-02-10 16:05:33] INFO During this run 100.0% of suites succeeded

@bharathsreekanth bharathsreekanth merged commit 480aa5f into usr/spark/unit-test-improvements Feb 10, 2025
6 of 7 checks passed
@bharathsreekanth bharathsreekanth deleted the usr/sreekb/reverseproxy-main-uts branch February 10, 2025 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants